package cn.wolfcode.cloud.shop.util;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;

/**
 * @Description: cookie的工具类
 * @Author: 伍家钰
 * @Date: 2020/9/7 20:37
 * @Version: 1.0
 */
public class CookieUtil {
    public static void addcookie(String cookieName, String cookieValue, int expierTime, HttpServletResponse response) {
        Cookie cookie = new Cookie(cookieName, cookieValue);
        cookie.setMaxAge(expierTime);
        cookie.setPath("/");
        // 响应给浏览器
        response.addCookie(cookie);
    }
}
